package com.bawei.lifecycle_test;

import android.app.Service;
import android.util.Log;

import androidx.lifecycle.LifecycleService;

//Service:被观察者 继承LifecycleService，此类实现LifecycleOwner接口
//注意：安卓的四大组件必须注册（静态注册+动态注册）
public class MyLocationService extends LifecycleService {
    public MyLocationService() {
        Log.d("ytx", "构造: ");
       MyLocationObserver myLocationObserver = new MyLocationObserver(this);
       getLifecycle().addObserver(myLocationObserver);
    }
}
